 	;(function() {
 		
 		$("#btn-submit").click(function(){
 			var card_no=$("#card_no").val();
			if(card_no==null||(card_no.length<5)){
				toastr["error"]("卡号不足5位");
				return false;
			}
 			var val=$("#shop_member").val();
 			if(val>0){
 				loading();
 				$.post(
 					"/admin/member/member_sync_post",
 					$("#validate-form").serialize(),
 					function(data){
 						close_loading();
 						if(data.flag){
 							toastr["success"]("成功");
 						}else{
 							toastr["error"](data.msg,"失败");
 						}
 					},
 					"json"
 				);
 				
 			}else{
 				toastr['error']("选择要同步的店铺会员!"); 
 			}
 		});
		//同步会员信息
		$("#btn-sync").click(function(){
			var card_no=$("#card_no").val();
			if(card_no==null||(card_no.length<5)){
				toastr["error"]("卡号不足5位");
				return false;
			}else{
				loading();
				$.post(
	   				"/admin/member/add_common_member",
	   				$("#validate-form").serialize(),
	   				function(data){
	   					close_loading();
			      		if(data.flag){
			      			var datas=data.data;
			      			var varify=["无验证","指纹","人脸","前台"];
			      			$("#shop_member").empty();
			      			$.each(datas, function(key,value) {
			      				$("#shop_member").append("<option value='"+value.shop_id+"'>"+value.shop_name+"--"+value.name+"--"+varify[value.in_varifycation_type]+"</option>");
			      			});
			      			toastr['success']("同步成功");
			      				return false;
			      		}else{
			      		 	toastr['error'](data.msg,"操作失败！"); 
			      		}
	   				},
	   				"json"
	   			);
			}
		})
})();
